package cn.zhaoguang.usedcar.common.util;

import cn.zhaoguang.usedcar.common.page.PageResult;
import com.github.pagehelper.PageInfo;

/**
 * @Description
 * @Author zhaoguang
 * @Date 2021/3/8 1:50
 */
public class PageHelperUtil {

    /**
     * @Description 分页结果
     * @Author zhaoguang
     */
    public static PageResult pageResult(PageInfo<?> pageInfo) {
        PageResult pr = new PageResult();

        pr.setCurrentPage(pageInfo.getPageNum());
        pr.setPageSize(pageInfo.getPageSize());
        pr.setTotalSize(pageInfo.getTotal());
        pr.setTotalPages(pageInfo.getPages());
        pr.setContent(pageInfo.getList());
        return pr;
    }
}
